00001 /////////////////////////////////////////////////////////////////////////////// 00002 /// @file deAnimatedMesh_priv.hpp 00003 /// 00004 /// @brief private header for animated mesh loading code 00005 /// 00006 /// @author Assassin 00007 /// 00008 /// This file is the intellectual property of Novus Delta, LLC.. Usage of the 00009 /// contents of this file is subject to the Destiny3D Member License which 00010 /// can be found at http://www.destiny3d.com. Any other usage is prohibited. 00011 /// 00012 /// This file is distributed "AS IS" without warranty of any kind. Novus 00013 /// Delta, LLC. does not guarantee the fitness of the contents of this file 00014 /// for any particular purpose. 00015 /// 00016 /// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved. 00017 /// 00018 /// <hr> 00019 /// Change History 00020 /// <hr> 00021 /// 00022 /// @date June 2002 00023 /// @author Assassin 00024 /// @remarks Creation 00025 /// 00026 /////////////////////////////////////////////////////////////////////////////// 00027 00028 //Destiny 3D Actor Class 00029 //A simple MD2 loader to start. Maybe we could build off this later. 00030 #ifndef DEANIMATEDMESH_PRIV_H 00031 #define DEANIMATEDMESH_PRIV_H 00032 00033 #include "deAnimatedMesh.hpp" 00034 #include "deString.hpp" 00035 #include "deResource_Helper.hpp" 00036 00037 typedef struct MD2Header MD2Header; 00038 typedef struct MD2FrameData MD2FrameData; 00039 typedef struct MD2Face MD2Face; 00040 typedef struct MD2Frame MD2Frame; 00041 typedef struct MD2TexCoord MD2TexCoord; 00042 typedef struct MD2Triangle MD2Triangle; 00043 typedef struct MD2TriangleVertex MD2TriangleVertex; 00044 00045 typedef char MD2Skin[64]; 00046 00047 class deAnimatedMesh : public deResourceBase, public IdeAnimatedMesh 00048 { 00049 public: 00050 deAnimatedMesh(); 00051 deAnimatedMesh(const char *filename); 00052 ~deAnimatedMesh(); 00053 void * GetRscInterface(long interface_id); 00054 00055 static long s_AnimatedMeshInterfaceID; 00056 00057 private: 00058 int m_NumTriangles; 00059 int m_NumFrames; 00060 int m_NumVertices; 00061 int m_NumTexCoords; 00062 int m_NumSkins; 00063 00064 MD2Face *m_pTriangles; 00065 MD2Skin *m_pSkins; 00066 MD2Frame *m_pFrames; 00067 00068 MD2TexCoord *m_pTexCoords; 00069 00070 IdeBitmapProxy *m_pBitmap; 00071 IdeRenderTexture *m_pTexture; 00072 IdeVertexBuffer *m_pVBuffer; 00073 deVertex **m_pVertices; 00074 deVertex **m_pNormals; 00075 00076 deTransform m_Transform; 00077 00078 int m_CurrentFrame; 00079 int m_NextFrame; 00080 00081 struct MD2Anim 00082 { 00083 deString AnimName; 00084 int Start,Stop; 00085 }; 00086 00087 float m_Interpolation; 00088 float m_AnimSpeed; 00089 deTArray <MD2Anim> m_Anims; 00090 int m_CurrentAnim; 00091 void InitVars(); 00092 00093 public: 00094 deBoolean LoadFromFile(const char *filename); 00095 void Destroy(); 00096 00097 IdeVertexBuffer* GetVBuffer(); 00098 IdeVertexBuffer* GetVBuffer(float Time); 00099 IdeRenderTexture* GetTexture(IdeDriver * pDriver); 00100 00101 int GetNumFrames(); 00102 int GetNumVerts(); 00103 int GetNumTriangles(); 00104 int GetNumSkins(); 00105 int GetFrameSize(); 00106 int GetNumTexCoords(); 00107 00108 int GetCurrentFrame(); 00109 int GetNextFrame(); 00110 float GetInterpolation(); 00111 00112 char *GetSkinName(int index); 00113 00114 void SetAnimSpeed(float FramesPerSec); 00115 deBoolean SetCurrentAnim(const char* AnimName); 00116 deBoolean SetCurrentAnim(int AnimNum); 00117 float GetAnimSpeed(); 00118 int GetCurrentAnim(); 00119 00120 void SetCurrentFrame(int frame); 00121 void SetNextFrame(int frame); 00122 00123 void SetTexture(const char *filename); 00124 void SetTexture(IdeBitmapProxy *tex); 00125 00126 bool LoadMD2(const char *filename); 00127 IdeResourceBase *MakeCopy(); 00128 }; 00129 00130 00131 00132 #endif // DEANIMATEDMESH_PRIV_H
1.3-rc3